package com.epam.traning.taskmanager.task;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import com.epam.traning.taskmanager.content.entity.TaskEntity;
import com.epam.traning.taskmanager.task.common.ListModelTask;
import com.epam.traning.taskmanager.task.common.ParamCallback;

public class ListTaskEntityTask extends ListModelTask<TaskEntity> {

	private static final String NAME = "name";
	private static final String ID = "id";

	public ListTaskEntityTask(ParamCallback<List<TaskEntity>> paramCallback) {
		super(paramCallback);
	}

	@Override
	public TaskEntity createModel(JSONObject jsonObject) throws JSONException {
		TaskEntity entity = new TaskEntity();
		entity.setId(jsonObject.getLong(ID));
		entity.setName(jsonObject.getString(NAME));
		return entity;
	}

}
